{template 'common/header'}

<ul class="nav nav-tabs">
	<li{if $operation == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('task',array('op' =>'display'))}">全部任务</a></li>
	<li{if empty($task['id']) && $operation == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('task',array('op' =>'post'))}">添加任务</a></li>
	<li{if $operation == 'done'} class="active"{else} style="display:none;" {/if}><a>用户任务明细</a></li>

</ul>

{if $operation == 'display'}
<div class="main panel panel-default">
	<div class="panel-body table-responsive">
		<form action="" method="post">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:10%;">排序</th>
					<th>任务会员类型</th>
					<th>任务名称</th>
					<th>开始时间</th>
					<th>结束时间</th>
					<th>任务状态</th>
					<th>任务数量</th>
					<th style="text-align:right;width:15%;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $adv}
				<?php
				    $done = array();
					if($settings['system_type'] == 1){
					    $done = pdo_fetchall("SELECT count(*) as num FROM " . tablename($this->modulename . "_user_task") . " WHERE task_id = ".$adv['task_id'].' and system_id='.$settings['system_id']);
					}else{
					    $done = pdo_fetchall("SELECT count(*) as num FROM " . tablename($this->modulename . "_user_task") . " WHERE task_id = ".$adv['task_id'].' and uniacid='.$_W['uniacid'].' and system_id=0');
					}
				   
				?>
				<tr>
					<td><input class="form-control" name="displayorder[{$adv['task_id']}]" value="{$adv['displayorder']}" type="text"></td>
					<td>
						<div>{if $adv['user_type']==0}普通会员任务{/if}{if $adv['user_type']==1}团长任务{/if}{if $adv['user_type']==2}合伙人任务{/if}{if $adv['user_type']==99}全员任务{/if}</div>
					</td>
					<td>{$adv['name']}</td>
					<td>{php echo date('Y-m-d H:i:s',$adv['start_time'])}</td>
					<td>{php echo date('Y-m-d H:i:s',$adv['end_time'])}</td>
					<td>{if $adv['status']==1}进行中{else}未开始/已结束{/if}</td>
					<td><a class="btn btn-primary btn-sm" href="{php echo $this->createWebUrl('task',array('id'=>$adv['task_id'],'op'=>'done'))}" title="任务数量">{$done[0]['num']}</a></td>
					<td style="text-align:right;">
					    <a href="{php echo $this->createWebUrl('task', array('op' => 'show', 'id' => $adv['task_id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="{if $adv['status'] == 1}结束任务{/if}">{if $adv['status'] == 1}结束任务{/if}{if $adv['status'] == 0}开始任务{/if}</a>
						<a href="{php echo $this->createWebUrl('task', array('op' => 'post', 'id' => $adv['task_id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="top" title="修改"><i class="fa fa-edit"></i></a>
						<a href="{php echo $this->createWebUrl('task', array('op' => 'delete', 'id' => $adv['task_id']))}"class="btn btn-default btn-sm" onclick="return confirm('此操作不可恢复，确认删除？');return false;" data-toggle="tooltip" data-placement="top" title="删除"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				{/loop}
				<tr>
					<td colspan="6">
						<input name="submit" class="btn btn-primary" value="提交" type="submit">
						<input name="token" value="{$_W['token']}" type="hidden">
					</td>
				</tr>
			</tbody>
		</table>
		</form>
	</div>
</div>
<script>
	require(['bootstrap'],function($){
		$('.btn').hover(function(){
			$(this).tooltip('show');
		},function(){
			$(this).tooltip('hide');
		});
	});
</script>
{elseif $operation == 'done'}
<div class="panel panel-info">
		<div class="panel-heading">筛选</div>
		<div class="panel-body">
			<form action="./index.php" method="get" class="form-horizontal" role="form" id="form1">
				<input type="hidden" name="c" value="site" />
				<input type="hidden" name="a" value="entry" />
				<input type="hidden" name="m" value="{php echo $this->modulename}" />
				<input type="hidden" name="do" value="task" />
				<input type="hidden" name="op" value="done" />
				<input type="hidden" name="id" value="{$_GPC['id']}" />
				

				<div class="form-group">
				    
					<label class="col-xs-12 col-sm-1 control-label" style="width: 10%;">任务状态</label>
					<div class="col-sm-2 col-xs-12" style="width: 15%;">
                        <select name="keyword1" class="form-control">
						    <option value="" >全部</option>
                            <option value="1" >完成</option>
							 <option value="2" >未完成</option>
                        </select>
                    </div>
					<div>
						<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
						<button type="button" class="btn btn-default">总记录数：{$total}</button>
					</div>
				</div>
			</form>
		</div>
</div>
<div class="main panel panel-default">
	<div class="panel-body table-responsive">
		<form action="" method="post">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th>昵称</th>
                    <th>会员号</th>
					<th>直推人数</th>
					<th>间推人数</th>
					<th>有效直推人数</th>
					<th>有效间推人数</th>
					<th>直推团长数量</th>
					<th>间推团长数量</th>
					<th>直推合伙人数量</th>
					<th>间推合伙人数量</th>
					<th>自购订单数量</th>
					<th>直推订单数量</th>
					<th>间推订单数量</th>
					<th>自购佣金</th>
					<th>直推佣金</th>
					<th>间推佣金</th>
					<th>总佣金</th>
					<th>任务状态</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $adv}
				<?php
				    $p_user = array();
				    if($settings['system_type'] == 1){
					    $p_user = pdo_get($this->modulename . "_user_u", array("unionid" => $adv['unionid'],'system_id' => $settings['system_id']));
					}else{
					    $p_user = pdo_get($this->modulename . "_user", array("user_id" => $adv['user_id'],'uniacid' => $_W['uniacid']));
					}
				?>
				<tr>
                    <td>
                        {if !empty($p_user['avatar'])}

                        <img style="width: 40px;" src="{$p_user['avatar']}">

                        {/if}

                        {$p_user['nickname']}

                    </td>

                    <td>{$p_user['uid']}</td>
					<td>{$adv['invite_sum']}</td>
					<td>{$adv['invite_allsum']}</td>
					<td>{$adv['invite_yxsum']}</td>
					<td>{$adv['invite_yxallsum']}</td>
					<td>{$adv['invite_tuan']}</td>
					<td>{$adv['invite_alltuan']}</td>
					<td>{$adv['invite_he']}</td>
					<td>{$adv['invite_allhe']}</td>
					<td>{$adv['order_sum']}</td>
					<td>{$adv['invite_order']}</td>
					<td>{$adv['invite_allorder']}</td>
					<td>{$adv['money']}</td>
					<td>{$adv['invite_money']}</td>
					<td>{$adv['invite_allmoney']}</td>
					<td>{$adv['allmoney']}</td>
					<td>{if $adv['status'] == 1}完成{else}未完成{/if}</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		{$pager}
		</form>
	</div>
</div>

{elseif $operation == 'post'}

<div class="main">
	<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" onsubmit='return formcheck()'>
		<input type="hidden" name="id" value="{$adv['task_id']}" />
		<div class="panel panel-default">
			<div class="panel-heading">
				任务设置
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">排序：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[displayorder]" class="form-control" value="{$adv['displayorder']}" />
						<span class="help-block">降序</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">任务名称：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" id='title' name="data[name]" class="form-control" value="{$adv['name']}" />
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">任务类型：</label>
					<div class="col-sm-9 col-xs-12">
					    <label class="radio-inline"><input type="radio" name="task_type" value="0" {if $adv['task_type'] == 0}checked="true"{/if} /> 普通任务</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="task_type" value="1" {if $adv['task_type'] == 1}checked="true"{/if} /> 新用户出单任务、老用户拉新出单任务</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">任务会员类型：</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline"><input type="radio" name="data[user_type]" value="0" {if $adv['user_type'] == 0}checked="true"{/if} /> 普通会员任务</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[user_type]" value="1" {if $adv['user_type'] == 1}checked="true"{/if} /> 团长任务</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[user_type]" value="2" {if $adv['user_type'] == 2}checked="true"{/if} /> 合伙人任务</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[user_type]" value="99" {if $adv['user_type'] == 99}checked="true"{/if} /> 全员任务</label>
					</div>
				</div>

				
				
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">开始时间：</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_date('start_time',date('Y-m-d H:i:s',$adv['start_time']),true);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">结束时间：</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_date('end_time',date('Y-m-d H:i:s',$adv['end_time']),true);}
					</div>
				</div>
				
			</div>
			<div class="panel-heading" id="task1" {if $adv['task_type'] == 0}{else}style="display:none;"{/if}>任务数据设置</div>
			<div class="panel-body" id="task2" {if $adv['task_type'] == 0}{else}style="display:none;"{/if}>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_sum]" class="form-control" value="{$adv['invite_sum']}" />
						<span class="help-block" style="color:red;">*直推人数，例如A推荐B，A直推人数+1</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">间推人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_allsum]" class="form-control" value="{$adv['invite_allsum']}" />
						<span class="help-block" style="color:red;">*间推人数（新增团队人数，不限级数），例如A推荐B，B推荐C，C推荐D，A间推人数+2</span>
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">有效直推人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_yxsum]" class="form-control" value="{$adv['invite_yxsum']}" />
						<span class="help-block" style="color:red;">*有效直推人数（用户已下单且订单已为结算状态），例如A推荐B，B已下单且订单已为结算状态，A有效直推人数+1</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">有效间推人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_yxallsum]" class="form-control" value="{$adv['invite_yxallsum']}" />
						<span class="help-block" style="color:red;">*有效间推人数（新增团队人数，不限级数，用户已下单且订单已为结算状态），例如A推荐B，B推荐C，C推荐D，CD已下单且订单已为结算状态，A有效间推人数+2</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推团长人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_tuan]" class="form-control" value="{$adv['invite_tuan']}" />
						<span class="help-block" style="color:red;">*直推团长人数，例如A推荐普通用户B，B升级为团长，A直推团长人数+1</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">间推团长人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_alltuan]" class="form-control" value="{$adv['invite_alltuan']}" />
						<span class="help-block" style="color:red;">*间推团长人数（新增团队团长人数，不限级数），例如A推荐普通用户B，B推荐C，C推荐D，CD升级为团长，A间推团长人数+2</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推合伙人人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_he]" class="form-control" value="{$adv['invite_he']}" />
						<span class="help-block" style="color:red;">*直推合伙人人数，例如A推荐普通用户B，B升级为合伙人，A直推合伙人人数+1</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">间推合伙人人数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_allhe]" class="form-control" value="{$adv['invite_allhe']}" />
						<span class="help-block" style="color:red;">*间推合伙人人数（新增团队合伙人人数，不限级数），例如A推荐普通用户B，B推荐C，C推荐D，CD升级为合伙人，A间推合伙人人数+2</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">自购订单数量：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[order_sum]" class="form-control" value="{$adv['order_sum']}" />
						<span class="help-block" style="color:red;">*自购订单数量，订单为结算状态</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">自购订单总佣金：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[money]" class="form-control" value="{$adv['money']}" />
						<span class="help-block" style="color:red;">*自购订单总佣金，订单为结算状态</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推订单数量：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_order]" class="form-control" value="{$adv['invite_order']}" />
						<span class="help-block" style="color:red;">*直推订单数量，例如A推荐普通用户B，B下1单且订单为结算状态，A直推订单数量+1</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">间推订单数量：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_allorder]" class="form-control" value="{$adv['invite_allorder']}" />
						<span class="help-block" style="color:red;">*间推订单数量（新增团队订单数量，不限级数），例如A推荐普通用户B，B推荐C，C推荐D，CD各下1单且订单为结算状态，A间推订单数量+2</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推订单总佣金：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_money]" class="form-control" value="{$adv['invite_money']}" />
						<span class="help-block" style="color:red;">*直推订单总佣金，例如A推荐普通用户B，B下1单，订单总佣金为10元，且订单为结算状态，A直推订单总佣金+10</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">间推订单总佣金：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[invite_allmoney]" class="form-control" value="{$adv['invite_allmoney']}" />
						<span class="help-block" style="color:red;">*间推订单总佣金（新增团队订单总佣金，不限级数），例如A推荐普通用户B，B推荐C，C推荐D，CD各下1单，订单总佣金为50元，且订单为结算状态，A间推订单总佣金+50。订单总佣金=平台佣金*总佣金比例</span>
					</div>
				</div>
			</div>
			<div class="panel-heading" id="task5" {if $adv['task_type'] == 1}{else}style="display:none;"{/if}>任务数据设置</div>
			<div class="panel-body" id="task6" {if $adv['task_type'] == 1}{else}style="display:none;"{/if}>
			    <div class="form-group" id="new_task_order_money" {if $adv['new_task_type'] == 0}{else}style="display:none;"{/if}>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">新用户有效天数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[new_task_day]" class="form-control" value="{$adv['new_task_day']}" />
						<span class="help-block" style="color:red;">*填写数字，新用户注册超过有效天数后就不能获得后续奖励。</span>
					</div>
				</div>
				<div class="form-group" id="new_task_order_money" {if $adv['new_task_type'] == 0}{else}style="display:none;"{/if}>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">订单最低金额：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[new_task_order_money]" class="form-control" value="{$adv['new_task_order_money']}" />
						<span class="help-block" style="color:red;">*填写数字，订单金额大于此金额才能获得奖励</span>
					</div>
				</div>
				<div class="form-group" id="new_task_up_money" {if $adv['new_task_type'] == 0}{else}style="display:none;"{/if}>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励金额：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[new_task_up_money]" class="form-control" value="{$adv['new_task_up_money']}" />
						<span class="help-block" style="color:red;">*填写示例：1|0.5,2|1,3|2,4|3,5|5，表示自购出第1单奖励0.5元，出第2单奖励1元，出第3单奖励2元，出第4单奖励3元，出第5单奖励5元，以此类推，逗号及竖杠为英文状态输入</span>
						<span class="help-block" style="color:blue;">*下面的奖励积分要与奖励金额的个数一样；</span>
					</div>
				</div>
				<div class="form-group" id="new_task_up_credit" {if $adv['new_task_type'] == 0}{else}style="display:none;"{/if}>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励积分：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[new_task_up_credit]" class="form-control" value="{$adv['new_task_up_credit']}" />
						<span class="help-block" style="color:red;">*填写示例：1|100,2|200,3|300,4|400,5|500，表示自购出第1单奖励100积分，出第2单奖励200积分，出第3单奖励300积分，出第4单奖励400积分，出第5单奖励500积分，以此类推，逗号及竖杠为英文状态输入</span>
						<span class="help-block" style="color:blue;">*奖励积分要与奖励金额的个数一样；</span>
					</div>
				</div>
				<div class="form-group" id="new_task_up_money_fa" {if $adv['new_task_type'] == 0}{else}style="display:none;"{/if}>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推上级奖励金额：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[new_task_up_money_fa]" class="form-control" value="{$adv['new_task_up_money_fa']}" />
						<span class="help-block" style="color:red;">*填写示例：1|0.5,2|1,3|2,4|3,5|5，表示自购出1单奖励0.5元，出2单奖励1元，出3单奖励2元，出4单奖励3元，出5单奖励5元，以此类推，逗号及竖杠为英文状态输入</span>
						<span class="help-block" style="color:blue;">*下面的奖励积分要与奖励金额的个数一样；</span>
					</div>
				</div>
				<div class="form-group" id="new_task_up_credit_fa" {if $adv['new_task_type'] == 0}{else}style="display:none;"{/if}>
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">直推上级奖励积分：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[new_task_up_credit_fa]" class="form-control" value="{$adv['new_task_up_credit_fa']}" />
						<span class="help-block" style="color:red;">*填写示例：1|100,2|200,3|300,4|400,5|500，表示自购出1单奖励100积分，出2单奖励200积分，出3单奖励300积分，出4单奖励400积分，出5单奖励500积分，以此类推，逗号及竖杠为英文状态输入</span>
						<span class="help-block" style="color:blue;">*奖励积分要与奖励金额的个数一样；</span>
					</div>
				</div>
			</div>
			<div class="panel-heading" id="task3" {if $adv['task_type'] == 0}{else}style="display:none;"{/if}>任务完成奖励设置</div>
			<div class="panel-body" id="task4" {if $adv['task_type'] == 0}{else}style="display:none;"{/if}>
				<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">会员升级奖励：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[up_type]" value="0" {if $adv['up_type'] == 0}checked="true"{/if} /> 不升级</label>
							&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[up_type]" value="1" {if $adv['up_type'] == 1}checked="true"{/if} /> 升级团长</label>
							&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[up_type]" value="2" {if $adv['up_type'] == 2}checked="true"{/if} /> 升级合伙人</label>
						</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励余额：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[up_money]" class="form-control" value="{$adv['up_money']}" />
						<span class="help-block" style="color:red;">*填写数字</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励积分：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[up_credit]" class="form-control" value="{$adv['up_credit']}" />
						<span class="help-block" style="color:red;">*填写数字</span>
					</div>
				</div>
			</div>
			<div class="panel-heading" id="task7" {if $adv['task_type'] == 0}{else}style="display:none;"{/if}>任务重复设置</div>
			<div class="panel-body" id="task8" {if $adv['task_type'] == 0}{else}style="display:none;"{/if}>
			    <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否重复任务：</label>
					<div class="col-sm-9 col-xs-12">
						<label class="radio-inline"><input type="radio" name="data[is_retask]" value="0" {if $adv['is_retask'] == 0}checked="true"{/if} /> 不重复</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[is_retask]" value="1" {if $adv['is_retask'] == 1}checked="true"{/if} /> 重复</label>
						&nbsp;&nbsp;&nbsp;
						<label class="radio-inline"><input type="radio" name="data[is_retask]" value="2" {if $adv['is_retask'] == 2}checked="true"{/if} /> 长期任务</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">重复次数：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[re_num]" class="form-control" value="{$adv['re_num']}" />
						<span class="help-block" style="color:red;">*填写数字</span>
					</div>
				</div>
			</div>
			<div class="panel-heading">任务状态设置</div>
			<div class="panel-body">
			    <div class="form-group">
				    <label class="col-xs-12 col-sm-3 col-md-2 control-label">任务状态：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[status]" value="0" {if $adv['status'] == 0}checked="true"{/if} /> 未开始/结束</label>
							&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[status]" value="1" {if $adv['status'] == 1}checked="true"{/if} /> 进行中</label>
						</div>
				</div>
			</div>
			<div class="panel-heading">任务完成奖励领取设置</div>
			<div class="panel-body">
			    <div class="form-group">
				    <label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励领取方式：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[lq_type]" value="0" {if $adv['lq_type'] == 0}checked="true"{/if} /> 系统自动领取（需设置计划任务）</label>
							<!--&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[lq_type]" value="1" {if $adv['lq_type'] == 1}checked="true"{/if} /> 任务中心手动领取</label>
							<span class="help-block" style="color:red;">*</span>-->
						</div>
				</div>
			</div>
			<div class="panel-heading">前端配置（以下的样式内容可不填，有默认值）</div>
			<div class="panel-body">
			    <div class="form-group">
				    <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否前端显示：</label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline"><input type="radio" name="data[is_online]" value="0" {if $adv['is_online'] == 0}checked="true"{/if} /> 不显示</label>
							&nbsp;&nbsp;&nbsp;
							<label class="radio-inline"><input type="radio" name="data[is_online]" value="1" {if $adv['is_online'] == 1}checked="true"{/if} /> 显示</label>
							<span class="help-block" style="color:red;">*是否在前端任务中心显示。</span>
						</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">进度条下方奖励说明：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[desc]" class="form-control" value="{$adv['desc']}" />
						<span class="help-block" style="color:red;">*进度条下方奖励说明</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">进度条下方奖励说明图标：</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_image('data[jp_url]', $adv['jp_url'], '', array('extras' => array('text' => 'readonly')))}
						<span class="help-block" style="color:red;">*图片尺寸：100*100，不上传则使用默认图片</span>
					</div>
				</div>
				<div class="form-group" style="display:none;">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖励积分商品ID：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[item_id]" class="form-control" value="{$adv['item_id']}" />
						<span class="help-block" style="color:red;">*进度条下方奖励说明</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">任务说明文章ID：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[page_id]" class="form-control" value="{$adv['page_id']}" />
						<span class="help-block" style="color:red;">*任务说明文章ID</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">任务说明文章URL：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[url]" class="form-control" value="{$adv['url']}" />
						<span class="help-block" style="color:red;">*任务说明文章URL</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">滑块背景线条颜色：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[bglineColor]" class="form-control" value="{$adv['bglineColor']}" />
						<span class="help-block" style="color:red;">*滑块背景线条颜色，默认值：#e5e5e5</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">滑块背景线条激活颜色：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[bglineAColor]" class="form-control" value="{$adv['bglineAColor']}" />
						<span class="help-block" style="color:red;">*滑块背景线条激活颜色，默认值：#ff9966</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">滑块背景颜色-左：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[barBgColor_left]" class="form-control" value="{$adv['barBgColor_left']}" />
						<span class="help-block" style="color:red;">*滑块背景颜色-左，默认值：#ffbf8a</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">滑块背景颜色-右：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[barBgColor_right]" class="form-control" value="{$adv['barBgColor_right']}" />
						<span class="help-block" style="color:red;">*滑块背景颜色-右，默认值：#ff9966</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">进度条下方奖励说明文字颜色：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[desc_color]" class="form-control" value="{$adv['desc_color']}" />
						<span class="help-block" style="color:red;">*进度条下方奖励说明文字颜色，默认值：#ffb664</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">详情背景色：</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="data[BgColor_wl]" class="form-control" value="{$adv['BgColor_wl']}" />
						<span class="help-block" style="color:red;">*详情背景色，默认值：#00b953</span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">领取图标：</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_image('data[lq_url]', $adv['lq_url'], '', array('extras' => array('text' => 'readonly')))}
						<span class="help-block" style="color:red;">*图片尺寸：100*100，不上传则使用默认图片</span>
					</div>
				</div>
			</div>

		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
	</form>
</div>
<script>
$("input:radio[name=task_type]").click(function(){
	var val = $(this).val();
	if(val == 0){
		$("#task1").show();
		$("#task2").show();
		$("#task3").show();
		$("#task4").show();
		$("#task7").show();
		$("#task8").show();
		$("#task5").hide();
		$("#task6").hide();
	}else if(val == 1){
		$("#task1").hide();
		$("#task2").hide();
		$("#task3").hide();
		$("#task4").hide();
		$("#task7").hide();
		$("#task8").hide();
		$("#task5").show();
		$("#task6").show();
	}
});
</script>
{/if}
{template 'common/footer'}